home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr47 / wasm223.zip / DRAW1.ASM < prev    next >
Assembly Source File  |  1993-05-04  |  3KB  |  107 lines

  1. ;**********************************;
  2. ; WASM Character Drawing           ;
  3. ; By Eric Tauck                    ;
  4. ;                                  ;
  5. ; Defines:                         ;
  6. ;                                  ;
  7. ;   DrwBox  draw a double line box ;
  8. ;                                  ;
  9. ; Requires:                        ;
  10. ;                                  ;
  11. ;   VIDEO4.ASM                     ;
  12. ;   VIDEO5.ASM                     ;
  13. ;**********************************;
  14.  
  15.         jmps    _draw1_end
  16.  
  17. ;================================================
  18. ; Display a top or bottom edge.
  19. ;
  20. ; In: AL= left corner character; AH= right corner
  21. ;     character; SI= rows and columns.
  22.  
  23. _drw_edge PROC  NEAR
  24.         push    ax
  25.         call    WrtChr          ;display left corner
  26.         call    CurAdv          ;advance cursor
  27.  
  28.         mov     al, '═'         ;bar
  29.         mov     cx, si          ;put columns in CL
  30.         dec     cl
  31.         dec     cl              ;reduce for corners
  32.         call    WrtChrs         ;display
  33.         call    CurAdv          ;advance cursor
  34.  
  35.         pop     ax              ;restore corners
  36.         mov     al, ah          ;load second corner
  37.         call    WrtChr          ;display
  38.         ret
  39.         ENDP
  40.  
  41. ;================================================
  42. ; Draw a double line box.  Note: this routine
  43. ; does not preserve the cursor location.
  44. ;
  45. ; In: BH= top left row; BL= top left
  46. ;     column; CH= bottom left row; CL=
  47. ;     bottom left column.
  48.  
  49. DrwBox  PROC   NEAR
  50.         push    di
  51.         push    si
  52.  
  53.         mov     di, bx          ;save home location
  54.         sub     cx, bx          ;rows and columns in CH and CL
  55.         mov     si, cx          ;save rows and columns in SI
  56.         add     si, 0101H       ;adjust
  57.  
  58. ;--- display top line
  59.  
  60.         mov     ax, di          ;home location
  61.         call    CurMov          ;position cursor
  62.         mov     ax, '╔╗'        ;load corners
  63.         call    _drw_edge       ;draw edge
  64.  
  65. ;--- display bottom line
  66.  
  67.         mov     ax, si          ;rows and columns
  68.         sub     al, al          ;zero columns
  69.         add     ax, di          ;add base location
  70.         dec     ah              ;adjust
  71.         call    CurMov          ;position cursor
  72.         mov     ax, '╚╝'        ;load corners
  73.         call    _drw_edge       ;draw edge
  74.  
  75. ;--- display sides
  76.  
  77.         mov     ax, si          ;rows and columns
  78.         sub     al, al          ;zero columns
  79.         add     ax, di          ;add base, bottom left corner
  80.         dec     ah              ;last row
  81.         and     si, 00FFH       ;just keep columns
  82.         dec     si              ;ajust, offset from edge to edge
  83.         jmps    _drwbx2
  84.  
  85. _drwbx1 push    ax              ;save location
  86.         call    CurMov          ;move cursor
  87.         mov     al, '║'         ;load character
  88.         call    WrtChr          ;display
  89.         pop     ax
  90.         push    ax
  91.         add     ax, si          ;add column offset
  92.         call    CurMov          ;position cursor
  93.         mov     al, '║'         ;load character
  94.         call    WrtChr          ;display
  95.         pop     ax
  96.  
  97. _drwbx2 dec     ah              ;decrement row
  98.         cmp     ax, di          ;check if done
  99.         jne     _drwbx1
  100.  
  101.         pop     si
  102.         pop     di
  103.         ret
  104.         ENDP
  105.  
  106. _draw1_end
  107.